<?php

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group(['namespace' => 'H5', 'prefix' => 'app'], function () {
    Route::get('pages/detail/{pageid}.html', 'PagesController@detail');
    Route::get('productnews/detail/{pageid}.html', 'ProductNewsController@detail');
});

Route::get('app/post/detail/{aid}.html', 'H5\PostController@detail');

Route::group(['namespace'=>'H5', 'prefix'=>'h5'], function (){
    Route::get('/', 'IndexController@index');
    Route::get('/test', 'IndexController@test');
    Route::get('qrcode', 'QrCodeController@index');

    Route::get('category', 'CategoryController@index');
    Route::get('category/getjson', 'CategoryController@getJson');
    Route::get('search', 'SearchController@index');
    Route::get('search/getjson', 'SearchController@getJson');

    //item
    Route::get('item/detail/{itemid}.html', 'ItemController@detail');
    Route::get('item/reviews', 'ItemController@reviews');
    Route::get('item/getreviews', 'ItemController@getReviews');
    //shop
    Route::get('shop', 'ShopController@index');
    Route::get('shop/viewshop/{shop_id}.html', 'ShopController@viewShop');
    Route::get('shop/getitems', 'ShopController@getItems');
    //post
    Route::get('post', 'PostController@index');
    Route::get('post/getitemlist', 'PostController@getItemList');
    Route::get('post/detail/{aid}.html', 'PostController@detail');
    //pages
    Route::get('pages', 'PagesController@index');
    Route::get('pages/detail/{pageid}.html', 'PagesController@detail');

    Route::get('productnews/detail/{pageid}.html', 'ProductNewsController@detail');

    Route::group(['middleware' => 'wechat'], function (){
        //index
        Route::get('/s', 'IndexController@index');
        //cart
        Route::get('cart', 'CartController@index');
        Route::get('cart/getjson', 'CartController@getJson');
        Route::any('cart/add', 'CartController@add');
        Route::any('cart/updatequantity', 'CartController@updateQuantity');
        Route::post('cart/delete', 'CartController@delete');
        //user
        Route::get('user', 'UserController@index');
        Route::get('security', 'SecurityController@index');
        Route::post('security/bind', 'SecurityController@bind');
        //address
        Route::get('address', 'AddressController@index');
        Route::post('saveaddress', 'AddressController@store');
        Route::get('deladdress', 'AddressController@delete');
        Route::get('getaddress', 'AddressController@getAddress');
        Route::get('getaddresslist', 'AddressController@getAddressList');
        Route::get('getdistrictjson', 'AddressController@getDistrictJson');
        //auction
        Route::any('auction/buynow', 'AuctionController@buyNow');
        Route::any('auction/createorder', 'AuctionController@createOrder');
        Route::any('auction/confirmorder', 'AuctionController@confirmOrder');
        Route::any('auction/settlement', 'AuctionController@settlement');
        //bought
        Route::get('bought', 'BoughtController@index');
        Route::any('bought/cancel', 'BoughtController@close');
        Route::any('bought/notice', 'BoughtController@notice');
        Route::any('bought/confirm', 'BoughtController@confirm');
        Route::any('bought/getshipping', 'BoughtController@getShipping');
        Route::any('bought/delete', 'BoughtController@delete');
        Route::get('bought/refund', 'BoughtController@refund');
        Route::post('bought/refund', 'BoughtController@applyRefund');
        Route::get('bought/cancelrefund', 'BoughtController@cancelRefund');
        Route::post('bought/resetrefund', 'BoughtController@resetRefund');
        Route::get('bought/evaluate', 'BoughtController@showEvaluate');
        Route::post('bought/evaluate', 'BoughtController@evaluate');
        Route::get('bought/getitemlist', 'BoughtController@getOrderList');
        Route::get('bought/detail', 'BoughtController@detail');
        Route::get('bought/addreview', 'BoughtController@showAddReview');
        Route::post('bought/addreview', 'BoughtController@addReview');
        //myshop
        Route::get('myshop', 'MyShopController@index');
        Route::get('myshop/openshop', 'MyShopController@openShop');
        Route::get('myshop/getimage', 'MyShopController@getImage');
        Route::get('myshop/getshop', 'MyShopController@getShop');
        Route::post('myshop/store', 'MyShopController@storeShop');
        //sold
        Route::get('sold', 'SoldController@index');
        Route::get('sold/detail', 'SoldController@detail');
        Route::any('sold/send', 'SoldController@send');
        //invite
        Route::get('invite', 'InviteController@index');
        Route::get('invite/bind', 'InviteController@bind');
        Route::get('invite/image', 'InviteController@image');

        Route::get('getShareContents','InviteController@getShareContents');
        Route::get('inviteshare/{uid}.html','InviteController@inviteshare');
        //pay
        Route::get('pay/getconfig', 'PayController@getConfig');
        //integral
        Route::get('point', 'PointController@index');
        Route::get('point/getjson', 'PointController@getJson');
        //coupon
        Route::get('coupon', 'CouponController@index');
        //collect
        Route::get('collect', 'CollectController@index');
        Route::any('collect/add', 'CollectController@create');
        Route::any('collect/getitemlist', 'CollectController@getCollectList');
        //kefu
        Route::get('kefu', 'KefuController@index');
        Route::get('kefu/bind/{shopid}', 'KefuController@bind');
        Route::any('kefu/binduser', 'KefuController@bindUser');
        //card
        Route::get('card', 'CardController@index');
        Route::post('card/store', 'CardController@store');
        Route::get('card/getjson', 'CardController@getJson');
        //team
        Route::get('team', 'TeamController@index');
        Route::get('team/geteamlist','TeamController@geteamlist');
        Route::get('team/getusers','TeamController@getUsers');
        //sms
        Route::get('sms/getcode', 'SmsController@getCode');
    });
});

Route::group(['namespace'=>'Mobile', 'prefix'=>'mobile'], function (){
    Route::get('/', 'IndexController@index');
    Route::get('/food', 'IndexController@food');
    Route::get('/youxuan', 'IndexController@youxuan');
    Route::get('/fupin', 'IndexController@fupin');
    Route::get('/catlog', 'CatlogController@index');
    Route::get('/catlog/getjson', 'CatlogController@getJson');
    Route::get('/catlog/{catid}', 'CatlogController@itemlist');

    Route::get('/cart', 'CartController@index')->middleware('wechat');
    Route::post('/cart/add', 'CartController@add')->middleware('wechat');

    Route::get('/item/detail/{itemid}.html', 'ItemController@detail');
    Route::get('/item/search', 'SearchController@getList');
    Route::get('/shop', 'ShopController@index');
    Route::get('/shop/getjson', 'ShopController@getjson');
    Route::get('/shop/viewshop/{shopid}.html', 'ShopController@viewshop');
    Route::any('/shop/getItems', 'ShopController@getItems');
    Route::get('/shop/profile/{shopid}', 'ShopController@profile');
    Route::get('/kefu/bind/{shopid}', 'KefuController@bind')->middleware('wechat');
    Route::any('/kefu/bindkefu', 'KefuController@bindKefu')->middleware('wechat');

    Route::any('auction/buynow', 'AuctionController@buynow')->middleware('wechat');
    Route::any('auction/createorder', 'AuctionController@createOrder')->middleware('wechat');
    Route::any('auction/getorderinfo', 'AuctionController@getOrderInfo')->middleware('wechat');
    Route::any('auction/settlement', 'AuctionController@settlement')->middleware('wechat');

    Route::get('trade/bought', 'BoughtController@index')->middleware('wechat');
    Route::get('trade/bought/getjson', 'BoughtController@getjson')->middleware('wechat');
    Route::get('trade/detail', 'BoughtController@detail')->middleware('wechat');
    Route::any('trade/refund', 'BoughtController@refund')->middleware('wechat');
    Route::any('trade/close_order', 'BoughtController@closeOrder')->middleware('wechat');
    Route::any('pay/getsign', 'PayController@getsign')->middleware('wechat');
    Route::any('pay/success', 'PayController@success')->middleware('wechat');

    Route::any('sold/detail', 'SoldController@detail')->middleware('wechat');

    Route::get('/post/detail/{aid}.html', 'PostController@detail');
    Route::get('/post/list', 'PostController@itemlist');

    Route::get('/pages/list', 'PagesController@index');
    Route::get('/pages/detail/{pageid}.html', 'PagesController@detail');

    Route::get('user', 'UserController@index')->middleware('wechat');
    Route::get('security', 'SecurityController@index')->middleware('wechat');
    Route::any('security/setpassword', 'SecurityController@setPassword')->middleware('wechat');
    Route::any('security/setemail', 'SecurityController@setEmail')->middleware('wechat');
    Route::any('security/setmobile', 'SecurityController@setMobile')->middleware('wechat');

    Route::any('feedback', 'FeedbackController@index')->middleware('wechat');
    Route::any('address', 'AddressController@index')->middleware('wechat');
    Route::any('collect', 'CollectController@index')->middleware('wechat');
    Route::any('collect/getjson', 'CollectController@getJson')->middleware('wechat');

    Route::any('news/','NewsController@getNews')->middleware('wechat');
    Route::any('news/edit','NewsController@edit')->middleware('wechat');
    Route::any('news/first','NewsController@first')->middleware('wechat');
    Route::any('news/created','NewsController@created')->middleware('wechat');
    Route::any('news/detail/{id}','NewsController@detail')->middleware('wechat');
    Route::any('news/uploads','NewsController@uploads')->middleware('wechat');
});
